﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using KC.Service.Admin;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Mvc;
using KC.Framework.SecurityHelper;

namespace KC.Web.Admin.Controllers
{
    //[Microsoft.AspNetCore.Authorization.Authorize]
    public abstract class AdminBaseController : KC.MVC.Core.Controllers.WebBaseController
    {
        protected ITenantUserService TenantService => ServiceProvider.GetService<ITenantUserService>();
        public AdminBaseController(
            IServiceProvider serviceProvider,
            ILogger logger)
            : base(serviceProvider, logger)
        {
        }

        public IActionResult GeneratePasswordHash(string password)
        {
            var result = EncryptPasswordUtil.EncryptPassword(password);
            return base.ThrowErrorJsonMessage(true, result);
        }
    }
}